package ru.silviasaint.fridge.server.bean;

import java.util.List;

import ru.silviasaint.fridge.server.bean.impl.Data;
import ru.silviasaint.fridge.server.bean.impl.LocaledSubstance;
import ru.silviasaint.fridge.shared.bean.ProductSkinny;
import ru.silviasaint.fridge.shared.bean.SkinnySubstance;

import com.j256.ormlite.table.DatabaseTable;
@DatabaseTable
public class Product extends LocaledSubstance{
	/**
	 *
	 */
	private static final long serialVersionUID = -2936216944649392599L;
	private List<Data> productData;
	public Product(){

	}
	public Product(String name, Long id){
		setId(id);
		setOriginalText(name);
	}
	public List<Data> getProductData() {
		return productData;
	}

	public void setProductData(List<Data> productData) {
		this.productData = productData;
	}
	@Override
	public String toString() {
		return getOriginalText();
	}
	@Override
	public SkinnySubstance convertToSkinny() {
		ProductSkinny skinny = new ProductSkinny();
		skinny.setId(getId());
		skinny.setValue(getOriginalText());
		return skinny;
	}
	@Override
	public void fillFromSkinny(SkinnySubstance substance) {
		ProductSkinny sp = (ProductSkinny) substance;
		setId(sp.getId());
		setOriginalText(sp.getValue());
	}
}
